package com.example.demo3.controller;


import com.example.demo3.dao.SystemUserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class SysUserController {
    @Autowired
    SystemUserDao systemUserDao;

    @PostMapping("/sysuser_reg")
    public boolean register(@RequestBody Map map){
        return systemUserDao.add_systemUser(map)==1;
    }

    @PostMapping("/sysuser_login")
    public String login(@RequestBody Map map){
        List<Map> users =
                systemUserDao.find_all_systemUser(map);
        if(users.size()==1){
            return "ok";
        }else{
            return "no";
        }
    }
}
